package iedcyt.acute.controller.listeners.document;

import iedcyt.acute.model.DocumentModel;
import iedcyt.acute.view.DocumentView;
import iedcyt.acute.view.ViewUtils;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

public class SignsKeyDownListener implements Listener {

	private DocumentModel _model;
	private DocumentView _view;
	
	public SignsKeyDownListener(DocumentView view, DocumentModel model) {
		this._model = model;
		this._view = view;
	}
	
	public void handleEvent(Event event) {
		
		Integer idSg = _model.getSelected_IdSign();
		
		char press = ("" + event.character).toLowerCase().toCharArray()[0];
		
		if (idSg != null)
		{
		//al pulsar 'a' se abre el documento
		if (press == 'a')
		{
			ViewUtils.getInstance().openSignView(idSg);
		}
		}
		
	}
}
